package services

import (
	"jlpay-sdk-go/pkg/jlpay/core"
	"jlpay-sdk-go/pkg/jlpay/models/base"
)

// BaseDataService 公共基础数据服务类
type BaseDataService struct {
	*BaseService
}

// NewBaseDataService 创建公共基础数据服务
func NewBaseDataService(config *core.Config) *BaseDataService {
	return &BaseDataService{
		BaseService: NewBaseService(config),
	}
}

// QueryBankList 查询银行总行信息
func (s *BaseDataService) QueryBankList(request *base.BankListRequest) (*base.BankListResponse, error) {
	response := &base.BankListResponse{}
	err := s.Post(request, response, "/open/base/data/bank/list")
	return response, err
}

// QueryBankBranchList 查询分支行信息
func (s *BaseDataService) QueryBankBranchList(request *base.BankBranchListRequest) (*base.BankBranchListResponse, error) {
	response := &base.BankBranchListResponse{}
	err := s.Post(request, response, "/open/base/data/bank-branch/list")
	return response, err
}

// QueryMcc 查询MCC信息
func (s *BaseDataService) QueryMcc(request *base.MccQueryRequest) (*base.MccQueryResponse, error) {
	response := &base.MccQueryResponse{}
	err := s.Post(request, response, "/open/base/data/mcc/query")
	return response, err
}

// QueryRegionList 查询地区码信息
func (s *BaseDataService) QueryRegionList(request *base.RegionListRequest) (*base.RegionListResponse, error) {
	response := &base.RegionListResponse{}
	err := s.Post(request, response, "/open/base/data/region/list")
	return response, err
}

// QueryBankCardBin 查询银行卡bin信息
func (s *BaseDataService) QueryBankCardBin(request *base.BankCardBinMatchingRequest) (*base.BankCardBinMatchingResponse, error) {
	response := &base.BankCardBinMatchingResponse{}
	err := s.Post(request, response, "/open/base/data/bank-cardbin/matching")
	return response, err
}
